package com.ruoyi.bizsys.mapper;

import java.math.BigDecimal;
import java.util.List;

import com.ruoyi.bizsys.domain.ProductDeferredInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.bizsys.domain.ProductRelationDeferred;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 产品延期金融包Mapper接口
 *
 * @author wqg
 * @date 2022-06-09
 */
public interface ProductDeferredInfoMapper extends BaseMapper<ProductDeferredInfo> {

    List<ProductDeferredInfo> getProductDerfereds(@Param("productId") long productId,
                                                  @Param("principal") BigDecimal principal,
                                                  @Param("repayDate") String repayDate,
                                                  @Param("periodNum") int periodNum,
                                                  @Param("deferredMaxDays") int deferredMaxDays);

    List<ProductDeferredInfo> getProductDerferedsForShow(@Param("productId") long productId,
                                                         @Param("principal") BigDecimal principal,
                                                         @Param("periodNum") int periodNum,
                                                         @Param("deferredMaxDays") int deferredMaxDays);

    /**
     * 检查传送延期id的数据是否符合
     * @param deferredId
     * @param principal
     * @param repayDate
     * @param periodNum
     * @param deferredMaxDays
     * @return
     */
    ProductDeferredInfo selectByIdForCheck(@Param("deferredId") int deferredId,
                                           @Param("principal") BigDecimal principal,
                                           @Param("repayDate") String repayDate,
                                           @Param("periodNum") int periodNum,
                                           @Param("deferredMaxDays") int deferredMaxDays);
    List<ProductDeferredInfo> selectCode();

    @Select("select id from product_relation_deferred where product_id=#{productRelationDeferred.productId} and product_deferred_id=#{productRelationDeferred.productDeferredId}")
    ProductDeferredInfo selectone(@Param("productRelationDeferred") ProductRelationDeferred productRelationDeferred);


    List<ProductDeferredInfo> selectCodeById(List<Integer> productDeferredInfoIds);

    Integer updateIds(List<Long> ids);

    List<ProductDeferredInfo> selectLists(ProductDeferredInfo productDeferredInfo);

    ProductDeferredInfo getname(Integer productDeferredId);

    ProductDeferredInfo selectCanUseById(String deferredId);

    ProductDeferredInfo selectProductDeferredInfo(String creditRating);

    ProductDeferredInfo selectproductDeferred(@Param("productId") String productId, @Param("day") String day);
}